//
// Created by gj on 16-2-20.
//

#ifndef ALLUTILS_RUNNABLE_H
#define ALLUTILS_RUNNABLE_H

#include "../pointer/SharePointer.h"
#include "CObject.h"
#include <time.h>

class CRunnable : public CObject {
public:
    static const CClassInformation _class;

    virtual const CClassInformation &getClass() const {
        return CObject::_class;
    }

    virtual ~CRunnable() {

    }

    virtual time_t getRunTime() const = 0;

    void *operator()() {
        return this->run();
    }

protected:
    virtual void *run() = 0;
};

typedef SharePointer<CRunnable> Runnable;

#endif //ALLUTILS_RUNNABLE_H
